<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!doctype html>
<html>
<head>
    <%@include file="common/head.jspf" %>
    <title>主页</title>
    <script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
    <script src="js/pages/shop/main.js"></script>
    <script>
        function onReady() {
            wx.config({
                debug: false,
                appId: "wx47ff0c58fec26a68",
                timestamp: <c:out value="${s.timestamp}"/>,
                nonceStr: "<c:out value="${s.noncestr}"/>",
                signature: "<c:out value="${s.signature}"/>",
                jsApiList: ["scanQRCode", "checkJsApi", "hideOptionMenu"]
            });

            wx.ready(function(){
                $("#confirm").click(scanOrder);
                wx.hideOptionMenu();
            });

            wx.error(function(res){
//                alert(res);
            });
        }

        function scanOrder() {
            wx.scanQRCode({
                needResult: 1, // 默认为0，扫描结果由微信处理，1则直接返回扫描结果，
                scanType: ["qrCode","barCode"], // 可以指定扫二维码还是一维码，默认二者都有
                success: function (res) {
                    location.href = "./shop/confirmPage?id=" + res.resultStr;
                }
            });
        }

        $(document).ready(onReady);
    </script>
</head>
<body>
<nav class="navbar text-nav" role="navigation">
    <div class="center-block nav-title">
        <c:out value="${sessionScope.shop.name}"/>
    </div>
</nav>
<div class="container">
    <div class="row">
        <div class="pull-right account">
            剩余积分：<c:out value="${sessionScope.shop.credit}"/>
        </div>
    </div>

    <div class="row">
        <div class="col-xs-6">
            <%--<a class="btn btn-pa-square" href="./shop/confirmPage?id=1424094275390474">订单确认</a>--%>
            <button class="btn btn-pa-square" id="confirm" type="button">订单确认</button>
        </div>
        <div class="col-xs-6">
            <a class="btn btn-pa-square" href="./shop/listPage">查看订单</a>
        </div>
    </div>

    <div class="row">&nbsp;</div>

    <div class="row">
        <div class="col-xs-6">
            <a class="btn btn-pa-square" href="javascript:void(0);" id="cash-btn">申请提现</a>
        </div>

        <div class="col-xs-6">
            <a class="btn btn-pa-square" href="./shop/infoPage">修改信息</a>
        </div>
    </div>

    <div class="row">&nbsp;</div>

    <div class="row">
        <div class="col-xs-6">
            <a class="btn btn-pa-square" href="./shop/pwPage">修改密码</a>
        </div>
        <div class="col-xs-6">
            <c:if test="${sessionScope.shopuser.main==1}">
                <a class="btn btn-pa-square" href="./shop/userPage">增加管理员</a>
            </c:if>
        </div>
    </div>

</div>
</body>
</html>
